static char SccsId[] = "@(#)spwave.c	1.1   9/21/95";
/*
 *         Copyright (c) KUBOTA Corporation and HUDSON SOFT,
 *                  1994, 1995 All Rights Reserved
 *
 *  This software comprises unpublished confidential information of
 *  KUBOTA Corp. and HUDSON SOFT. It may not be used, copied or made
 *  available to anyone, except in accordance with the license under
 *  which it is furnished.
 */

#define ASL_USE_MACRO

#include <farl.h>
#include <asl.h>

#if !defined( sindi )
#define sindi(x)        ( (short)FarlGetSin187( (x) ) << 1 )
#endif

void
main()
{
	int		i, j;
	ASLSct		sct;
	ASLPt		pt[64];
	ASLSource	src;

	FX73init();
	FX73_cmap_i5c4();
	FarlInit();
	ASLSetSpriteWindow( 0, 0, 255, 239 );

	sct.head	= ASL_VAL_FNC_TBL | 0;
	sct.cntl	= 0;
	sct.dsp_x_pos	= 88;
	sct.dsp_y_pos	= 96;
	sct.dsp_xy_size = ( ( 80 - 1 ) << ASL_SFT_DSP_X_SIZE )
				| ( ( 64 - 1 ) << ASL_SFT_DSP_Y_SIZE );
	sct.src_xy_pos	= (  0 << ASL_SFT_SRC_X_POS )
				| (  0 << ASL_SFT_SRC_Y_POS );
	sct.src_xy_size	= ( ( 64 - 1 ) << ASL_SFT_SRC_X_SIZE )
				| ( ( 64 - 1 ) << ASL_SFT_SRC_Y_SIZE );
	sct.pt_bank_sel	= 2;
	sct.pt_off_addr	= 0;
	ASLSetSpriteTable( 1, 0, 1, &sct );

	for ( i = 0;; i++ ) {
		for ( j = 0; j < 64; j++ ) {
			pt[j].x_off  = -8 +
				8 * sindi( ( ( i + j ) * 110 ) % 3600 ) / 256;
			pt[j].y_off  = j;
			pt[j].x_scan = 1 * 256;
			pt[j].y_scan = 0 * 256;
		}

		ASLSetParameterTable( 2, 0, 64, pt );
		ASLExecuteSprite( 1, 0, 1 );

		/*	Swap buffer.	*/
		ASLSync();
		FarlSwapWindow();
		ASLWaitForSwap();
	}
}

